<template>
	<view class="scan-view">
		<view class="top-bar"><uni-navbar :fixed="true" :back="false" color="#fff" title="扫码签到"></uni-navbar></view>

		<view class="container">
			<view class="img-box">
				<view class="image"><image src="/static/img/erw.png" mode="widthFix"></image></view>
			</view>
			<view class="fiexd-btm"><u-button class="form-btn" type="error" @click="qrcodeComplete2">扫一扫</u-button></view>
		</view>
	</view>
</template>

<script>
import { mapState } from 'vuex';
export default {
	data() {
		return {};
	},
	onLoad() {
		this.loadLogin();
	},
	computed: {
		...mapState(['userInfo'])
	},
	methods: {
		loadLogin() {
			if (this.userInfo.sysUser) {
				uni.scanCode({
					onlyFromCamera: true,
					success: res => {
						this.$qrcodeResult(res);
					}
				});
			} else {
				this.$logout();
			}
		},
		qrcodeComplete2(e) {
			uni.scanCode({
				onlyFromCamera: true,
				success: res => {
					this.$qrcodeResult(res);
				}
			});
		}
	}
};
</script>

<style lang="scss">
.img-box {
	position: relative;
	margin: 40rpx 0;
	padding: 60rpx 30rpx;
	border-radius: 30rpx;
	background-color: #fff;
	background-image: none;

	.image {
		margin: 0 auto;
		width: 430rpx;
	}
}
</style>
